package com.d.client;

import com.d.client.dto.YidaFromInstanceResultDTO;
import com.d.client.dto.YidaFromInstanceWriteDTO;
import com.d.client.dto.YidaOperationRecordsResultDTO;
import com.d.client.dto.YidaProcessInstanceInfosResultDTO;
import com.d.client.interceptor.DingInterceptor;
import com.dtflys.forest.annotation.*;


@BaseRequest(baseURL = "${dingUrl}", contentType = "application/json",
        charset = "UTF-8", interceptor = DingInterceptor.class)
public interface YidaClient {
    /**
     * 创建审批实例
     * @return
     */
    @Request(url = "/yida/processes/instances/start",type = "POST")
    YidaFromInstanceResultDTO createProcess(@Body YidaFromInstanceWriteDTO r);

    /**
     *
     * @param id,  审批流程实例标识
     * @param appType  应用id
     * @param systemToken 应用标识
     * @param userId 用户id
     * @return
     */
    @Get(url = "/yida/processes/instancesInfos/{id}")
    YidaProcessInstanceInfosResultDTO instancesInfos(@Var("id") String id, @Query("appType")String appType, @Query("systemToken") String systemToken, @Query("userId") String userId);

    /**
     *
     * @param processInstanceId 实例id
     * @param appType 应用id
     * @param systemToken 应用标识
     * @param userId 用户id
     * @return
     */
    @Request(url = "/yida/processes/operationRecords",type = "GET")
    YidaOperationRecordsResultDTO operationRecords(@Query("processInstanceId")String processInstanceId, @Query("appType")String appType, @Query("systemToken") String systemToken, @Query("userId") String userId);

}
